/*
 *http://www.apache.org/licenses/LICENSE-2.0
 *Copyright (c) 2021 fullset
 *@ClassName XmSelectData
 *@date 2021/6/27 14:25
 *@author: pangps
 *@Description 下拉框数据初始化
 */
package com.fs.orm.data;

import com.fs.core.util.StringUtil;
import com.fs.orm.layui.XmSelect;

import java.util.ArrayList;
import java.util.List;

public class XmSelectData {

    /**
     * 性别下拉框
     * @param value
     * @return
     */
    public static List<XmSelect> getSex(String value){
        List<XmSelect> list = new ArrayList<>();
        if(StringUtil.isEmpty(value)){
            value = "M";
        }
        list.add(new XmSelect("男", "M", false, "M".equals(value)));
        list.add(new XmSelect("女", "F", false, "F".equals(value)));
        return list;
    }

    /**
     * 用户状态下拉框
     * @param value
     * @return
     */
    public static List<XmSelect> getUserState(Integer value){
        List<XmSelect> list = new ArrayList<>();
        if(null == value){
            value = 0;
        }
        list.add(new XmSelect("正常", "0", false, 0==value));
        list.add(new XmSelect("冻结", "1", false, 1==value));
        list.add(new XmSelect("关闭", "2", false, 2==value));
        return list;
    }

}
